import { objDeepCopy,getDateString } from "@/assets/js/common.js";
let Controller = {
	mounted() {
		this.initdata();
	},
	methods: {
		initdata() {
			this.Model.orderNumber = this.$route.query.id;		//订单id
			this.Model.Outofstock = this.$route.query.flag;		//订单id
			this.requestDetail(this,this.Model.orderNumber);
		},
		//详情接口
		requestDetail(that,id) {
			this.$ajax({
				method: 'post',
				//url:'/api/supplier/whWarehouseDetail/outAndInDetails',
				url:this.apiTest+'/supplier/whWarehouseDetail/outAndInDetails',
				data:{
					condition:{
						number:id
					}
				}
			}).then((res)=>{
				var data = res.data;
				if(data.status == 200){
					var result = data.result;
					console.log(result)
					//应出商品（已出）
					that.Model.tableDataOutNews = objDeepCopy(result.actualSaleGoodsInfoVos);
					//应出商品（未出）
					that.Model.tableData = objDeepCopy(result.shouldSaleGoodsInfoVos);
					//操作日志
					that.Model.tableData4 = objDeepCopy(result.whWarehouseLogList);
					//表头信息
					that.Model.tabFormInline = [{
							label: '退货单号',
							value: result.number,
						},
						{
							label: '单据状态',
							value: result.status,
						},
					];
					//出库单基础信息
					that.Model.tableFormInline = [{
							label: '出库单类型',
							value: result.type
						},
						{
							label: '出库仓库',
							value: result.outWarehouseName
						},
						{
							label: '供应商名称',
							value: result.supplierName
						},
						{
							label: '操作人',
							value: result.operatorName
						},
						{
							label: '打印次数',
							value: result.printCount
						},
						{
							label: '导出次数',
							value:result.exportCount
						}
					];
				}else{
					that.tips(that,'warning',data.msg)
				}
			
			});
		},
		setStepData(list, status) {
			
		},
		
		warehousing(row) {
			this.Model.warehousingDialogStatus = row.status;
			this.Model.warehousingDialogFlag = true;
		},
		handleSelectionChange(val) {
			console.log(val);
		},
		handleCurrentChange(val) {
			this.Model.pager.params.pageIndex = val;
		},
		handleSizeChange(val) {
			this.Model.pager.params.pageSize = val;
		},
		cardClick(color) {
			this.Model.cardSelected = color;
		},
		showChild(val) {
			this.Model.searchFromData = val;
		},
		toSearch(val) {
			console.log(val)
		},
		toClear(val) {
			this.Model.searchFromData = this.Model.defaultSearchFromData;
		},
		toExport(val) {
			console.log(val);
		},
		handleChange() {
			
		},	
		//查sku码
		checkSku(val) {
			val = this.Model.writeSku;
			console.log(val)
		},
		onTabChange(val) {
			switch (val) {
				case 1:
					break;
				case 2:
					break;
				case 3:
					break;
			}
		},
		//展开收缩
		toggleTableDetail(val) {
			const obj = this.Model[val];
			if (obj.flag === true) {
				this.Model[val].src = require('@/assets/img/icon_collapse.png');
				this.Model[val].flag = false;
			} else {
				this.Model[val].src = require('@/assets/img/icon_unfold.png');
				this.Model[val].flag = true;
			}
		},
		tips(that,type,message) {
			that.$message({
				message: message,
				type: type
			});
		},
	}
}
export default Controller;
